entry: Activate default via action
authorMatthias Clasen <mclasen@redhat.com>
Sun, 28 Apr 2019 18:12:53 +0000 (18:12 +0000)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 28 Apr 2019 23:20:13 +0000 (23:20 +0000)
Switch to the new way of activating default.

gtk/gtkentry.c
gtk/gtkentry.h
gtk/gtktext.c
gtk/gtktextprivate.h

index 03b7271fd7593d0324ab7ea7d5917e11a4e97d4a..04d955cea0e30a33be03138b3c81c19f6ddbe5b8 100644 (file)
@@ -2120,10 +2120,6 @@ gtk_entry_get_text_length (GtkEntry *entry)
  * widget for the window containing the entry. This usually means that
  * the dialog box containing the entry will be closed, since the default
  * widget is usually one of the dialog buttons.
- *
- * (For experts: if @setting is %TRUE, the entry calls
- * gtk_window_activate_default() on the window containing the entry, in
- * the default handler for the #GtkEntry::activate signal.)
  **/
 void
 gtk_entry_set_activates_default (GtkEntry *entry,
index 66da3da82204a4404b822c3f6990c44b102260cf..d6948686d4270e3d14ff999d8f429d0fc7070bcc 100644 (file)
@@ -82,8 +82,7 @@ struct _GtkEntry
  *   non-%NULL, this will be called to add additional entries to the context
  *   menu when it is displayed.
  * @activate: Class handler for the #GtkEntry::activate signal. The default
- *   implementation calls gtk_window_activate_default() on the entry’s top-level
- *   window.
+ *   implementation activates the gtk.activate-default action.
  * @move_cursor: Class handler for the #GtkEntry::move-cursor signal. The
  *   default implementation specifies the standard #GtkEntry cursor movement
  *   behavior.
index f93293a3421df5901869dbd540a8424f60c7f6bb..75e17e11aaedb247c2131d92c46d05e21a74938e 100644 (file)
@@ -3839,30 +3839,9 @@ static void
 gtk_text_real_activate (GtkText *self)
 {
   GtkTextPrivate *priv = gtk_text_get_instance_private (self);
-  GtkWindow *window;
-  GtkWidget *default_widget, *focus_widget;
-  GtkWidget *toplevel;
-  GtkWidget *widget;
-
-  widget = GTK_WIDGET (self);
 
   if (priv->activates_default)
-    {
-      toplevel = gtk_widget_get_toplevel (widget);
-      if (GTK_IS_WINDOW (toplevel))
-        {
-          window = GTK_WINDOW (toplevel);
-
-          if (window)
-            {
-              default_widget = gtk_window_get_default_widget (window);
-              focus_widget = gtk_root_get_focus (GTK_ROOT (window));
-              if (widget != default_widget &&
-                  !(widget == focus_widget && (!default_widget || !gtk_widget_get_sensitive (default_widget))))
-                gtk_window_activate_default (window);
-            }
-        }
-    }
+    gtk_widget_activate_default (GTK_WIDGET (self));
 }
 
 static void
index 60be0035d821a5d05b10c375c06be7f1cf86c64c..ec1d0af6d2e682cb6bc47fd173ce330d1e27d059 100644 (file)
@@ -38,8 +38,7 @@ typedef struct _GtkTextClass         GtkTextClass;
  *   non-%NULL, this will be called to add additional entries to the context
  *   menu when it is displayed.
  * @activate: Class handler for the #GtkText::activate signal. The default
- *   implementation calls gtk_window_activate_default() on the entry’s top-level
- *   window.
+ *   implementation activates the gtk.activate-default action.
  * @move_cursor: Class handler for the #GtkText::move-cursor signal. The
  *   default implementation specifies the standard #GtkText cursor movement
  *   behavior.